package com.yjd.bi.gift.service.impl;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;
import org.springframework.stereotype.Service;

import com.yjd.comm.base.dao.IBaseDao;
import com.yjd.comm.base.service.impl.BaseServiceImpl;
import com.yjd.comm.gift.model.GiftRegisterBindModel;
import com.yjd.comm.gift.service.IGiftRegisterBindService;
import com.yjd.bi.gift.dao.IGiftRegisterBindDao;

/**
 * <b>description</b>：微信分享红包业务实现<br>
 * <b>time</b>：2016-12-08 13:15:22 <br>
 * <b>author</b>：  ready likun_557@163.com
 */
@Service("giftRegisterBindService")
public class GiftRegisterBindServiceImpl extends BaseServiceImpl implements IGiftRegisterBindService {

	/**
	 * 插入
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public GiftRegisterBindModel insert(GiftRegisterBindModel model) throws Exception {
		return this.giftRegisterBindDao.insertModel(model, true);
	}

	/**
	 * 更新
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public int update(GiftRegisterBindModel model) throws Exception {
		return this.giftRegisterBindDao.updateModel(model, true);
	}

	/**
	 * 根据id删除
	 * 
	 * @param user_id
	 * @return
	 * @throws Exception
	 */
	public int delete(long user_id) throws Exception {
		Map<Object, Object> paramMap = new HashMap<Object, Object>();
		paramMap.put("user_id", user_id);
		return this.giftRegisterBindDao.deleteModel(paramMap, true);
	}

	@Resource
	private IGiftRegisterBindDao giftRegisterBindDao;

	@Override
	public IBaseDao getBaseDao() {
		return this.giftRegisterBindDao;
	}

}
